package com.hl.qzzpbackend.model.enums;

import cn.hutool.core.util.ObjUtil;
import lombok.Getter;

/**
 * 职位申请状态枚举
 * @author helong
 */
@Getter
public enum ApplicationStatusEnum {

    DELIVERED(0, "已投递"),
    DURING_THE_INTERVIEW(1, "面试中"),
    EMPLOYMENT(2, "录用"),
    REJECT(2, "拒绝");



    private final Integer value;
    private final String text;

    // 构造函数
    ApplicationStatusEnum(Integer value, String text) {
        this.value = value;
        this.text = text;
    }


    /**
     * 根据value获取枚举
     * @param value 枚举值的value
     * @return 枚举值
     */
    public static ApplicationStatusEnum getEnumByValue(Integer value) {
        if(ObjUtil.isEmpty(value)) {
            return null;
        }
        for (ApplicationStatusEnum applicationStatusEnum : ApplicationStatusEnum.values()) {
            if (applicationStatusEnum.getValue().equals(value)) {
                return applicationStatusEnum;
            }
        }
        return null;
    }
}
